package com.example.demo.service;


import com.example.demo.mapper.OrdersMapper;
import com.example.demo.pojo.Mysell;
import com.example.demo.pojo.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yanglup
 * @create 2020-11-23 20:42
 */
@Service
public class OrdersServiceImpl implements OrdersService{
    @Autowired
    OrdersMapper ordersMapper;


    /**创建订单*/
    @Override
    public void createorderstable(String openidbuy, String consignee_addr, Integer order_price, Integer goods_id, Integer goods_number, Integer goods_price) {
        ordersMapper.createorderstableinsert(openidbuy,consignee_addr,order_price,goods_id,goods_number,goods_price);
    }
    /**修改状态*/
    @Override
    public void updatestatus(Integer goods_id) {
        ordersMapper.updatestatus(goods_id);
    }



    /**点击发货发货的1--买方显示待发货信息*/
    @Override
    public List<Order> awaitorders(String openidbuy) {
        return ordersMapper.awaitorders(openidbuy);
    }
    /**点待收货*/
    @Override
    public List<Order> awairece(String openidbuy) {
        return ordersMapper.awairece(openidbuy);
    }
    /**退款*/
    @Override
    public List<Order> tuikuan(String openidbuy) {
        return ordersMapper.tuikuan(openidbuy);
    }
    /**全部*/
    @Override
    public List<Order> allorders(String openidbuy) {
        return ordersMapper.allorders(openidbuy);
    }

    /**修改为退款状态*/
    @Override
    public void clicktuikuan(Integer goods_id) {
        ordersMapper.clicktuikuancre(goods_id);
        ordersMapper.clicktuikuangood(goods_id);
    }
    /**修改为退款状态*/
    @Override
    public void confirmget(Integer goods_id) {
        ordersMapper.confirmgetcre(goods_id);
        ordersMapper.confirmgetgood(goods_id);
    }
    /**申请退货*/
    @Override
    public void applyreturngoods(String openidbuy,Integer goods_id) {
        ordersMapper.applyreturngoodscre(openidbuy,goods_id);
    }



    /**卖家点击发货*/
    @Override
    public void delivergoods(Integer goods_id) {
        ordersMapper.delivergoodscre(goods_id);
        ordersMapper.delivergoodsgood(goods_id);
    }

    /**卖家同意退货,如果卖家同意后改变商品状态变为5*/
    @Override
    public void agreereturn(String openid,Integer goods_id) {
        ordersMapper.agreereturn(openid,goods_id);
        ordersMapper.agreereturnzhuangtai4(goods_id);
        ordersMapper.agreereturngood(goods_id);
    }



    /**卖家待发货*/
    @Override
    public List<Order> selldaifahuo(String openid) {
        return ordersMapper.selldaifahuo(openid);
    }
    /**卖家待收货*/
    @Override
    public List<Order> sellyifahuo(String openid) {
        return ordersMapper.sellyifahuo(openid);
    }
    /**卖家退款*/
    @Override
    public List<Order> selltuihuo(String openid) {
        return ordersMapper.selltuihuo(openid);
    }
    /**卖家全部订单*/
    @Override
    public List<Order> sellallgoods(String openid) {
        return ordersMapper.sellallgoods(openid);
    }




    /**--------------------------------mysell------------------------------------------------*/
    @Override
    public List<Mysell> mysell(String openid) {
        return ordersMapper.mysell(openid);
    }
    /**计算数量*/
    @Override
    public Integer mysellcount(String openid) {
        return ordersMapper.mysellcount(openid);
    }
}
